package com.mars.admin.modules.banner.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mars.admin.modules.base.entity.BaseEntity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;

/**
 * 轮播图实体
 *
 * @author Mars
 * @version 1.0
 * @date 2025-08-05
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Table("tb_banner")
@Schema(description = "轮播图")
public class Banner extends BaseEntity {

    /**
     * 主键ID
     */
    @Id(keyType = KeyType.Auto)
    @Schema(description = "主键ID", example = "1")
    private Long id;

    /**
     *
     */
    @Schema(description = "关联轮播图详情ID", example = "1")
    private Long toDetailId;

    /**
     * 轮播图类型（activity、topic...)
     */
    @Schema(description = "轮播图类型（activity、topic...)", example = "activity")
    private String type;
    /**
     * 轮播图标题
     */
    @Schema(description = "轮播图标题", example = "首页轮播图1")
    private String title;

    /**
     * 图片URL
     */
    @Schema(description = "图片URL", example = "https://example.com/banner1.jpg")
    private String imageUrl;

    /**
     * 跳转链接
     */
    @Schema(description = "跳转链接", example = "https://example.com/detail/1")
    private String link;

    /**
     * 展示位置标识，如home, app, web等
     */
    @Schema(description = "展示位置标识", example = "home")
    private String position;

    /**
     * 排序值，越小越靠前
     */
    @Schema(description = "排序值", example = "1")
    private Integer sort;

    /**
     * 状态：0-禁用，1-启用
     */
    @Schema(description = "状态", example = "1")
    private Integer status;

    /**
     * 开始时间
     */
    @Schema(description = "开始时间", example = "2025-08-01 00:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(onInsertValue = "now()")
    private LocalDateTime startTime;

    /**
     * 结束时间
     */
    @Schema(description = "结束时间", example = "2025-08-31 23:59:59")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(onInsertValue = "now()")
    private LocalDateTime endTime;

    /**
     * 备注
     */
    @Schema(description = "备注", example = "这是首页的轮播图")
    private String remark;
}
